<?php

class Application_Model_Dao_SteelMapper extends Base_Mapper
{

	function __construct(){
		parent::__construct();
		$this->tableName = 'Application_Model_DbTable_Steel';
	}

   
	public function find($id)
	{
		$result = $this->getDbTable()->find($id);
		if (0 == count($result)) {
			return;
		}
		$row = $result->current();
		return $this->toModel($row);		
	}
   
	public function fetchAll()
	{
		$resultSet = $this->getDbTable()->fetchAll(null,"show_order");
		$entries   = array();
		foreach ($resultSet as $row) {	
			$entry = $this->toModel($row);
			$entries[] = $entry;
		}
		return $entries;
	}
	
	private function toModel($record){
		$steel = new Application_Model_BusiInfo_Steel(); 
		$steel->set_id($record->id);
	    $steel->set_name($record->name);
	    $steel->set_showOrder($record->show_order);
	    return $steel;
		
	}
	
}

